package com.aqgj.UserRole.dao;

import com.aqgj.UserRole.bean.UserRole;
import com.aqgj.util.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 
 * </p>
 * 
 * @ClassName UserRoleDao
 * @JDK 1.5
 * @author 
 * @date  
 */
@Repository("UserRoleDao")
public class UserRoleDao extends BaseDaoImpl<UserRole> {
    public List<String> selectRoleIdListByUserId(String id){
        String sql = "select role_id AS roleId from user_role where user_id = ?";
        return super.currentSession().createNativeQuery(sql).setParameter(1,id).getResultList();
    }

    public int deleteByUserId(String id){
        String sql = "DELETE FROM user_role WHERE user_id = ?";
        return super.currentSession().createNativeQuery(sql).setParameter(1,id).executeUpdate();
    }
}